1. Field of the Invention
The present invention relates to the design of virtual machines for computer systems. More specifically, the present invention relates a method and an apparatus for initializing system classes associated with a virtual machine and storing portions of the initialized system classes into a Read Only Memory (ROM) at virtual machine build time.
2. Related Art
The exponential growth of the Internet has in part been fueled by the development of computer languages, such as the JAVA™ programming language distributed by Sun Microsystems, Inc. of Santa Clara, Calif. The JAVA programming language allows an application to be compiled into a module containing platform-independent byte codes, which can be distributed across a network of many different computer systems. Any computer system possessing a corresponding platform-independent virtual machine, such as the JAVA VIRTUAL MACHINE™, is then able to execute the byte codes. In this way, a single form of an application can be easily distributed to and executed by a large number of different computing platforms.
Most virtual machines, such as the JAVA VIRTUAL MACHINE, perform references to system classes containing methods that perform system functions. These system classes are typically loaded and initialized at run time. Unfortunately, both the loading and initialization operations can require a significant amount of time, which can greatly increase the amount of time it takes to initialize a virtual machine.
In order to remedy this problem, some systems store portions of the system classes into Read-Only Memory (ROM) during build time for the virtual machine. (This process is referred to as “romization.”) In this way, it is not necessary to load the system classes at run time, which reduces initialization time for the virtual machine. However, the system classes must still be initialized at run time.
Moreover, bytecodes loaded into ROM cannot be modified at runtime. Hence, it is not possible to perform a common performance improvement technique known as “byte code quickening,” which modifies bytecodes to make use of resolved pointers. At run time, bytecodes within a given class frequently make references to bytecodes and fields in other classes. These inter-class references must first be resolved before the references can take place. Once a reference has been resolved, bytecodes that perform the same reference can be “quickened” by modifying them to use the resolved reference. Bytecodes cannot be modified in ROM. Hence, they cannot be quickened at run time.
What is needed is a method and an apparatus for reducing the amount of time required to initialize system classes within a virtual machine without the problems listed above.